<template>
    <div class="Tomakeanappointmentcourse">
        <div class="conetnst">
            <!-- <div class="conetnst-heads">
                <div class="heeadser" id="app">
                    <el-cascader size="large" :options="options" v-model="selectedOptions" @change="handleChange"></el-cascader>
                    <div class="srrcah">
                        <el-input v-model="input" placeholder="搜索私教名称"></el-input>
                        <span>搜索</span>
                    </div>
                </div>
            </div> -->
            <div class="contents-list">
                <div class="titles"> 
                    <h3>预约私教</h3>
                    <!-- <label>
                        <span>智能排序</span>
                        <span>距离</span>
                    </label> -->
                </div>
                <div class="contentList">
                    <ul>
                        <li v-for="(item,index) in sijiaoList" :key="index" @click="tosijiao(item)">
                            <img :src="item.photo" alt="" class="sijiaoPhoto">
                            <div class="listinfos">
                                <h3>{{item.full_name}}</h3>
                                <el-rate v-model="item.score" disabled></el-rate>
                                <span>{{item.sex == 1?'男':'女'}}  {{item.master_age}}岁</span>
                                <span>掌握语言：{{item.teach_language}}</span>
                            </div>
                            <span class="sijiaojuli">{{item.distance}}km</span>
                            <span class="sijiaoyueke" @click.stop="popupOpen(item)">约课</span>
                        </li>
                    </ul>
                </div>
                <div class="Lvie-cl-de-con-pagination" style="margin: 39px;text-align: right;">
                    <el-pagination @current-change="handleCurrentChange" background layout="prev, pager, next" :total="1000"></el-pagination>
                </div>
            </div>
        </div>
        
        <Yueke v-show="popup" :popup.sync ='popup' ref="mychild"></Yueke>
    </div>
</template>
<script>
import { regionData } from 'element-china-area-data'
import Yueke from '../../../components/yueke'
export default {
    name:'Booksijiao',
    data () {
      return {
        service_type:1,
        Classtypesvlaue: "",
        selectDatetime:'',
        Classtypes: [
            {
                label: "1",
                value: "线上服务",
                id: 1
            },
            {
                label: "2",
                id: 2,
                value: "上门服务"
            }
        ],
        offline_mobile:'',
        student_count:'',
        offline_address:'',
        offline_count:1,
        popup:false,
        options: regionData,
        selectedOptions: [],
        currentPage:1,
        sijiaoList:[],
        yuekeinfo:[],
        Isshow:false,
        input:'',
        userinfo:JSON.parse(localStorage.getItem('userinfo')),
        languageList:[{
                languageE:"Estonian",
                languageC:"爱沙尼亚语"
                },
            {
                languageE:"Arabic",
                languageC:"阿拉伯语"
                },
            {
                languageE:"Bulgarian",
                languageC:"保加利亚语"
                },
            {
                languageE:"Polish",
                languageC:"波兰语"
                },
            {
                languageE:"Danish",
                languageC:"丹麦语"
                },
            {
                languageE:"German",
                languageC:"德语"
                },
            {
                languageE:"Russian",
                languageC:"俄语"
                },
            {
                languageE:"Traditional Chinese",
                languageC:"繁体中文"
                },
            {
                languageE:"French",
                languageC:"法语"
                },
            {
                languageE:"Finnish",
                languageC:"芬兰语"
                },
            {
                languageE:"Korean",
                languageC:"韩语"
                },
            {
                languageE:"Dutch",
                languageC:"荷兰语"
                },
            {
                languageE:"Czech",
                languageC:"捷克语"
                },
            {
                languageE:"romanian",
                languageC:"罗马尼亚语"
                },
            {
                languageE:"Portuguese",
                languageC:"葡萄牙语"
                },
            {
                languageE:"Japanese",
                languageC:"日语"
                },
            {
                languageE:"Swedish",
                languageC:"瑞典语"
                },
            {
                languageE:"slovenian",
                languageC:"斯洛文尼亚语"
                },
            {
                languageE:"Thai",
                languageC:"泰语"
                },
            {
                languageE:"Spanish",
                languageC:"西班牙语"
                },
            {
                languageE:"Greek",
                languageC:"希腊语"
                },
            {
                languageE:"hun",
                languageC:"匈牙利语"
                },
            {
                languageE:"Italian",
                languageC:"意大利语"
                },
            {
                languageE:"English",
                languageC:"英语"
                },
            {
                languageE:"Vietnamese",
                languageC:"越南语"
                },
            {
                languageE:"cantonese",
                languageC:"粤语"
                },
            {
                languageE:"Chinese",
                languageC:"中文"
            }],
      }
    },
    created() {
        this.getsijiaoList()
        this.initData();
    },
    computed:{
            offline_address:{
               get(){
                   this.fn(this.$refs.child.offline_address);
                   return this.$refs.child.offline_address;
               } 
            }
        },
    components: {//组件注册
        Yueke
    },
    methods:{
        tosijiao(e){
            console.log(e)
            this.$router.push({ path:'/views/Teachingcenters/Teachersdetails',query: {NavListIndex : 3,routerData :e.user_id}})
        },
        dataSearch() {
            this.getListByDataTime();
        },
        jisuan(type){
            if(type == 1){
                if(this.offline_count < 2){
                    this.$message('不能小于1')
				}else{
					this.offline_count = this.offline_count - 1
				}
            }else if(type == 2){
                this.offline_count = this.offline_count + 1
            }
        },
        initData(data) {
            //获取当前时间
            var now   = new Date();
            var monthn = now.getMonth()+1;
            var yearn  = now.getFullYear();
            var dayn = now.getDate();
            var h = now.getHours();
            var m =now.getMinutes();
            var s = now.getSeconds();
            this.selectDatetime = yearn+"-"+monthn+"-"+dayn+" "+h+":"+m+":"+s;

            this.selectUser = parseInt(sessionStorage.getItem("userid"));
            this.getListByDataTime();
        },
        getListByDataTime(data) {

        },
        ChangeClasstypes(e) {
            this.service_type = e.label;
        },
        popupClose(){
            let _this = this
            _this.popup = false
        },
        popupOpen(item){
            let _this = this
            _this.popup = true
            _this.$refs.mychild.getYuekeInfo(item.user_id)
        },
        getsijiaoList(){
            let _this = this
            let data = {
                latitude:localStorage.getItem('latitude'),
                longitude:localStorage.getItem('longitude'),
                status:2,
                type:'private_education',
                currentPage:this.currentPage,
                pageSize:10,
            }
            console.log(data)
            _this.$axios({
                method:'get',
                url:'http://101.37.66.151:8768/eg-api/user/masterInfo/queryMasterListPage',
                params:data,
            }).then((res) =>{
                console.log(res.data)
                this.sijiaoList = res.data.data
                this.sijiaoList.map(item=>{
                    this.languageList.map(itam=>{
                        if(item.teach_language == itam.languageE){
                            item.teach_language = itam.languageC
                        }
                    })
                    item.distance = (item.distance/1000).toFixed(1)
                })
            }).catch((error) =>{
                console.log(error)
            })
        },
        handleCurrentChange(val){
            this.currentPage =val
            this.getsijiaoList()
        },
        handleChange (value) {
            console.log(value)
        },
        mapshow(){
            var _this = this
            _this.Isshow = true
        }
    }
}
</script>
<style lang="less" scoped>
    .popup_button{
    text-align: center;
    position: absolute;
    bottom: 30px;
    width: 100%;
    font-size: 19px;
    span{
        color: #ff0000;
    }
    div{
        display: inline;
        background-color: #4078F7;
        color: #fff;
        padding: 8px;
        font-size: 16px;
        margin-left: 152px;
        border-radius: 10px;
        cursor: pointer;
    }
}
.info_address{
    display: block;
    width: 83%;
    text-align: left;
    height: 40px;
    position: relative;
    top: 62px;
    left: 22px;
    input {
        width: 57.5%;
        height: 30px;
        border: 1px solid #cecece;
        padding: 2px 10px 2px 10px;
        outline: none;
        margin-left: 12.5%;
        border-radius: 3px;
        cursor: no-drop;
    }
    .adds {
        width: 16px;
        height: 20px;
        cursor: pointer;
        position: absolute;
        left: 91%;
        top: 8px;
    }
}
.info_classNum{
    display: block;
    width: 80%;
    text-align: left;
    height: 40px;
    position: relative;
    top: 55px;
    left: 22px;
    .title {
        display: inline-block;
        width: 18%;
        height: 40px;
        line-height: 40px;
        text-align: left;
    }
    .num{
        font-size: 23px;
    }
    img{
        margin-left: 14px;
        width: 20px;
        height: 20px;
        margin-right: 14px;
        vertical-align: middle;
    }
}
.info_mobile{
    display: block;
    width: 84%;
    text-align: left;
    height: 40px;
    position: relative;
    top: 55px;
    left: 22px;
    span {
        display: inline-block;
        width: 18%;
        height: 40px;
        line-height: 40px;
        text-align: left;
    }
    input {
        width: 74.5%;
        height: 30px;
        border: 1px solid #cecece;
        padding: 2px 10px 2px 10px;
        outline: none;
        margin-left: 0.5%;
        border-radius: 3px;
    }
}
.info_time{
    height: 60px;
    align-items: center;
    position: relative;
    top: 80px;
    left: -46px;
    /deep/.el-input {
        width: 360px;
        position: relative;
        left: 150px;
        top: -33px;
    }
}
.popup_info{
    font-size: 15px;
    position: relative;
    top: 10px;
    left: 14px;
    width: 96%;
    height: 40px;        
}
.info_type{
    height: 60px;
    align-items: center;
    position: relative;
    top: 37px;
    left: -46px;
    /deep/.el-select {
        width: 67%;
        border: #cecece;
        margin-left: 4%;
    }
    /deep/.el-select__tags{
        width: 40%;
    }
}
.popup_head{
    width: 84%;
    height: 133px;
    background-color: rgba(214,226,236,1);
    padding: 10px;
    font-size: 15px;
    margin-left: 30px;
    border-radius: 20px;
    margin-top: -16px;
}
.head_pingfen{
    position: relative;
    top: -90px;
    left: 120px;
}
.head_photo{
    width: 100px;
    height: 130px;
    border-radius: 10px;
}
.head_name{
    position: relative;
    top: -101px;
    left: 26px;
    font-weight: bold;
    font-size: 18px;
}
.head_language{
    position: relative;
    top: -70px;
    left: 120px;
}
.head_serveType{
    background-color: #EA9919;
    padding: 7px;
    border-radius: 10px;
    color: #fff;
    font-size: 12px;
    position: relative;
    top: -143px;
    left: 207px;
}
.popup_close{
    position: relative;
    top: 10px;
    left: 520px;
}
.login1 {
    position: fixed;
    font-size: 24px;
    height: 545px;
    width: 958px;
    background-color: #fdfdfd;
    border-radius: 1.25rem;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1005;
}
.over1 {
  position: fixed;
  width: 100%;
  height: 100%;
  opacity: 0.7; //透明度为70%
  filter: alpha(opacity=70);
  top: 0;
  left: 0;
  z-index: 1004;
  background-color: #111111;
}
.popupcontents{
    position: relative;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
  }
  .popupcontents>div{
    width: 1063px;
    height: 576px;
    overflow: hidden;
    border-radius: 20px;
  }
.login {
    position: fixed;
    font-size: 24px;
    height: 557px;
    width: 560px;
    background-color: #fdfdfd;
    border-radius: 1.25rem;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1003;
}
.over {
  position: fixed;
  width: 100%;
  height: 100%;
  opacity: 0.7; //透明度为70%
  filter: alpha(opacity=70);
  top: 0;
  left: 0;
  z-index: 1002;
  background-color: #111111;
}
.Listofinstitutions{
        position: relative;
        width: 100%;
        background:rgba(241,241,241,1);
    }
    .conetnst{
        position: relative;
        width: 1400px;
        margin: 0 auto;
    }
    .conetnst-heads{
        position: relative;
        width: 80%;
        height: 106px;
        background: #ffffff;
        border-radius: 20px;
        top: -2px;
    }
    .heeadser{
        width: 90%;
        margin: 0 auto;
        padding-top: 30px;
        display: flex;
        // /deep/.distpicker-address-wrapper{

        // }
    }
    .srrcah{
        margin-left: auto;
        display: flex;
        /deep/.el-input{
            height: 33px;
            margin-right: 20px;
            /deep/.el-input__inner{
                height: 33px;
                border-radius: 20px;
            }
        }
        span{
            display: inline-block;
            width:120px;
            height:33px;
            text-align: center;
            line-height: 33px;
            color: #ffffff;
            background:rgba(71,206,207,1);
            border-radius:17px;
            cursor: pointer;
        }
    }
    .contents-list{
        position: relative;
        width: 80%;
        background: #ffffff;
        padding-bottom: 7px;
        border-radius: 20px;
        height: 1034px;
    }
    .titles{
        position: relative;
        width: 86%;
        height: 80px;
        margin: 0 auto;
        border-bottom: 1px solid #2DC7C8;
        display: flex;
        align-items: center;
        padding-left: 4%;
        color: #2DC7C8;
        font-size: 20px;
        font-weight: bold;
    }
    .contentList{
        position: relative;
        width: 90%;
        margin: 0 auto;
        bottom: 0px;
        .sijiaoyueke{
            position: relative;
            top: 39px;
            left: -15px;
            width: 150px;
            background: #28C5C6;
            height: 30px;
            line-height: 30px;
            text-align: center;
            font-size: 14px;
            color: #fff;
            border-radius: 15px;
            cursor: pointer;
        }
        .sijiaojuli{
            position: relative;
            top: 6px;
            left: 48px;
            color: #ccc;
            font-size: 15px;
            font-weight: bold;
        }
        .sijiaoPhoto{
            width: 104px;
            height: 135px;
            border-radius: 10px;
        }
        ul{
            list-style: none;
            display: flex;
            list-style: none;
            flex-direction: row;
            flex-wrap: wrap;
            margin: 0 auto;
            padding: 0;
            justify-content: space-between;
            li{
                display: flex;
                width: 47%;
                margin-top: 16px;
                border: 1px solid #47CECF;
                border-radius: 10px;
                padding: 10px;
                cursor: pointer;
            }
        }
    }
    .listinfos{
        display: flex;
        flex-wrap: wrap;
        padding-left: 30px;
        align-items: center;
        h3{
            width: 100%;
            margin: 0;
            font-size: 18px;
            color: #2A2A2A;
        }
        div{
            width: 100%;
        }
        span{
            display: inline-block;
            width: 100%;
            color: #C9C9C9;
            font-size: 13px;
        }
    }
    .lookmap{
        color: #47CECF!important;
        background-image: url('/images/椭圆 31@2x.png');
        background-repeat: no-repeat;
        background-size: 11px 13px;
        background-position-x: 10%;
        background-position-y: 50%;
        cursor: pointer;
    }
</style>